package com.lk.spring.boot.sample.util;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

/**
 * 自定义异常处理 全局异常捕捉
* <p>Title:ExeptionHandler </p>
* <p>Description: </p>
* <p>Company: </p> 
* @author kexl
* @date 下午2:05:57
 */
@ControllerAdvice
public class ExeptionHandler {
	
	@ExceptionHandler(value=Exception.class)
	public ModelAndView defaultErrorHandler(HttpServletRequest request,Exception exception){
		ModelAndView model=new ModelAndView("/error/404");
		model.addObject("e",exception);
		model.addObject("uri", request.getRequestURI());
		
		return model;
	}

}
